#include <iostream>
#include <string>
#include "contacts.pb.h"

int main()
{
    contacts::contact con;
    con.set_age(18);
    con.set_name("zhangsan");
    con.set_score(99);

    std::string str = con.SerializeAsString();

    contacts::contact stu;
    bool ret = stu.ParseFromString(str);
    if(!ret)
    {
        std::cout << "反序列化失败" << std::endl;
        return -1;
    }
    std::cout << stu.age() << "\n";
    std::cout << stu.name() << "\n";
    std::cout << stu.score() << "\n";

    return 0;
}